package com.hpjpw.ido.controller;

import java.util.List;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.hpjpw.ido.domain.AnonymousThumb;
import com.hpjpw.ido.service.IAnonymousThumbService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 撕逼墙点赞Controller
 * 
 * @author hpj
 * @date 2021-01-02
 */
//@Api(value ="AnonymousThumbController")
@RestController
@RequestMapping("/ido/anonymous_thumb")
public class AnonymousThumbController extends BaseController
{
    @Autowired
    private IAnonymousThumbService anonymousThumbService;

    /**
     * 查询撕逼墙点赞列表
     */
    @PreAuthorize("@ss.hasPermi('ido:anonymous_thumb:list')")
    @GetMapping("/list")
    //@ApiOperation("查询撕逼墙点赞列表")
    public TableDataInfo list(AnonymousThumb anonymousThumb)
    {
        startPage();
        List<AnonymousThumb> list = anonymousThumbService.selectAnonymousThumbList(anonymousThumb);
        return getDataTable(list);
    }

    /**
     * 导出撕逼墙点赞列表
     */
    @PreAuthorize("@ss.hasPermi('ido:anonymous_thumb:export')")
    @Log(title = "撕逼墙点赞", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    //@ApiOperation("导出撕逼墙点赞列表")
    public AjaxResult export(AnonymousThumb anonymousThumb)
    {
        List<AnonymousThumb> list = anonymousThumbService.selectAnonymousThumbList(anonymousThumb);
        ExcelUtil<AnonymousThumb> util = new ExcelUtil<AnonymousThumb>(AnonymousThumb.class);
        return util.exportExcel(list, "anonymous_thumb");
    }

    /**
     * 获取撕逼墙点赞详细信息
     */
    @PreAuthorize("@ss.hasPermi('ido:anonymous_thumb:query')")
    @GetMapping(value = "/{id}")
    //@ApiOperation("获取撕逼墙点赞详细信息")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return AjaxResult.success(anonymousThumbService.selectAnonymousThumbById(id));
    }

    /**
     * 新增撕逼墙点赞
     */
    @PreAuthorize("@ss.hasPermi('ido:anonymous_thumb:add')")
    @Log(title = "撕逼墙点赞", businessType = BusinessType.INSERT)
    @PostMapping
    //@ApiOperation("新增撕逼墙点赞")
    public AjaxResult add(@RequestBody AnonymousThumb anonymousThumb)
    {
        return toAjax(anonymousThumbService.insertAnonymousThumb(anonymousThumb));
    }

    /**
     * 修改撕逼墙点赞
     */
    @PreAuthorize("@ss.hasPermi('ido:anonymous_thumb:edit')")
    @Log(title = "撕逼墙点赞", businessType = BusinessType.UPDATE)
    @PutMapping
    //@ApiOperation("修改撕逼墙点赞")
    public AjaxResult edit(@RequestBody AnonymousThumb anonymousThumb)
    {
        return toAjax(anonymousThumbService.updateAnonymousThumb(anonymousThumb));
    }

    /**
     * 删除撕逼墙点赞
     */
    @PreAuthorize("@ss.hasPermi('ido:anonymous_thumb:remove')")
    @Log(title = "撕逼墙点赞", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    //@ApiOperation("删除撕逼墙点赞")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(anonymousThumbService.deleteAnonymousThumbByIds(ids));
    }
}
